<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	List<TsUser> list = (List<TsUser>)request.getAttribute("list");
	LeaveForm form = (LeaveForm)request.getAttribute("command");
	//获取权限范围的分公司ID
	String defaultSiteId = request.getAttribute("defaultSiteId")+"";
%>
<div class="main">
	<div class="oaTable">
<table class="tableList">

	<thead>
		<tr>
			<td colspan="10" style="width: 100%;">
				<div class="FormTools">
					<div>工号：
						<input id="userid" type="text" name="userid" class="search" value="<%=StringUtils.isNotBlank(form.getUserid())?form.getUserid():""%>"
							placeholder="请输入员工编号"/>
						<input type="button" class="searchSubmit" onclick="javascript:XF.Check.userListSearch()" value="搜索"/>
					</div>
					<div>姓名：
						<input id="username" type="text" name="username" class="search" value="<%=StringUtils.isNotBlank(form.getUsername())?form.getUsername():""%>"
							placeholder="请输员工姓名"/>
					</div>
					<div>部门：
						<select id="deptList" class="easyui-combobox" name="deptid" style="width:100px;"></select>
					</div>					
					<div>所属公司：
						<select id="siteList" class="easyui-combobox" name="siteid" style="width:100px;"></select>
					</div>
				</div>
			</td>
		</tr>
	</thead>

	<tbody>
		<tr id="tableHeader">
			<th style="width: 10%">工号</th>
			<th style="width: 5%">员工姓名</th>
			<th style="width: 5%">部门</th>
			<th style="width: 5%">公司名称</th>
			<th style="width: 12%">权限</th>
			<th style="width: 18%">操作</th>
		</tr>
		<%
			if (list != null && list.size() > 0) {
				for (TsUser user: list) {
					String id = EncrypTool.encode(user.getUserid()+"");
		%>
						<tr>
							<td><%=user.getUserid() %></td>
							<td><%=user.getUsername() %></td>
							<td><%=user.getDeptname()%></td>
							<td><%=user.getSitename()%></td>
							<td><%=user.getRoleDescs()%></td>
							<td>
								<div class="innerBtnWrap">
									<a class="a-btn-microsoft btn" href="javascript:XF.Check.editUser('<%=id %>')">授权</a>
								</div>
							</td>
						</tr>
					<%
				}
			}
		
		%>
		        
        		<tr id="tableFooter">
			<td colspan="10">
				<div class="pagination">
					<monggoTag:pagination href="user_search"
						pageSize="<%=form.getPageSize()%>"
						totalRecord="<%=form.getTotalRecord() %>"
						currentPage="<%=form.getPageNum() %>">
					</monggoTag:pagination>
				</div>
			</td>
		</tr>
	</tbody>
</table>
</div>
</div>
<script>
$('#siteList').combobox({
	url:global.contextPath + '/company/siteList',
	valueField:'siteid',
	textField:'sitename',
});
$('#deptList').combobox({
	url:global.contextPath + '/company/deptList',
	valueField:'dictid',
	textField:'dictname',
});
$('#siteList').combobox('setValue', '<%=form.getSiteid() %>');
$('#deptList').combobox('setValue', '<%=form.getDeptid() %>');
</script>